{% extends "toast/base.template.html" %}
{% load toast_filters %}


{% block breadcrumbs %}
	<li class="active">Members</span>
{% endblock %}


{% block sidecontent %}
	<p class="lead">Add Member</p>
	
	<form method="POST" action="/toast/member/add/">
	{% csrf_token %}
		<h6>{{ form.first_name.label }}</h6>
		<input type="text" name="first_name" data-content="{{ form.first_name.help_text }}" />
		<p class="text-error">{{ form.first_name.errors.as_text }}</p>

		<h6>{{ form.last_name.label }}</h6>
		<input type="text" name="last_name" data-content="{{ form.last_name.help_text }}" />
		<p class="text-error">{{ form.last_name.errors.as_text }}</p>

		<h6>{{ form.email.label }}</h6>
		<input type="text" name="email" data-content="{{ form.email.help_text }}" />
		<p class="text-error">{{ form.email.errors.as_text }}</p>

		<h6>{{ form.phone.label }}</h6>
		<input type="text" name="phone" data-content="{{ form.phone.help_text }}" />
		<p class="text-error">{{ form.phone.errors.as_text }}</p>

		<input class="btn btn-primary" type="submit" name="member_add" value="Add Member" />
	</form>
{% endblock %}


{% block content %}
{% if list_of_members %}
	<table class="table">
		<thead>
		<tr>
			<th>Member</th>
			<th>E-Mail</th>
			<th>Phone</th>
			<th>Action(s)</th>
		</tr>
		</thead>
		<tbody>
		{% for member in list_of_members %}
		<tr>
			<td><a href="/toast/member/view/{{ member.id }}">{{ member.first_name_first }}</a></td>
			<td>{{ member.email }}</td>
			<td>{{ member.phone|format_phone }}</td>
			<td><div class="btn-group pull-right">
				<a class="btn btn-primary" href="#"><i class="icon-wrench icon-white"></i> Actions</a>
				<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a>
				<ul class="dropdown-menu">
					<li><a href="/toast/member/view/{{ member.id }}"><i class="icon-eye-open"></i> View</a></li>
					<li><a href="/toast/member/edit/{{ member.id }}"><i class="icon-pencil"></i> Edit</a></li>
					<li><a href="/toast/member/delete/{{ member.id }}" class="confirm" message="Are you sure you want to delete this member ({{ member.name }})?"><i class="icon-trash"></i> Delete</a></li>
				</ul>
			</div>
			<div class="clearfix"></div>
			</td>
		</tr>
		{% endfor %}
		</tbody>
	</table>
{% else %}
{% endif %}
{% endblock %}